This forum is closed to new posts and
responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:
~Vanessa Dwofreeskioden 5.Jan.04 11:49 AM a Web browser Domino Designer All Releases All Platforms
I am calling a Java agent from a lotus notes agent to send email in HTML format. We used this code on v5.10 and it worked fine after updating the server to 6.0.3 it is not working correctly. Anyone have an ideas, help is greatly appreciated, more information below. It keeps giving an error of:
Agent error: java.net.SocketException: Connection reset by peer: socket closed
// Vars for the socketed conenction to the SMTP server
Socket sock;
DataOutputStream dos;
byte[] b = null;
// Connect to the SMTP server
sock = new Socket( "127.0.0.1", 25 );
BufferedReader br = new BufferedReader(new InputStreamReader(sock.getInputStream()));
dos = new DataOutputStream( sock.getOutputStream() );
// Say hello and reset. Reset not needed if everything OK but it does not hurt.
//Also if server doesn't respond that it will error out, not sending email.
br.readLine();
dos.writeBytes("HELO SERVER/COMPANY\n" );
// From needs to be an Valid SMTP address
dos.writeBytes("MAIL FROM: " + doc.getItemValueString("principal") + " \n");
br.readLine();
// Recipients. One line for each recipient.
br.readLine();
// Need to start data for text and header of the email.
dos.writeBytes("DATA\n");
br.readLine();
//This is the information that will show in the header section of the email. ( To, From and Subject )
dos.writeBytes("To: " + doc.getItemValueString("UserName") + "<" + doc.getItemValueString("sendTo") + "> \n");
dos.writeBytes("From: " + doc.getItemValueString("SentFrom") + "<" + doc.getItemValueString("principal") + "\n"); //" < " + doc.getItemValueString("from") +">\n");
dos.writeBytes("Subject: " + doc.getItemValueString("Subject") +" \n");
// Set the type to HTML
dos.writeBytes("Mime-Version: 1.0\n");
dos.writeBytes("Content-Type: text/html; charset=\"us-ascii\"\n\n");
// Add the Body and end it with full stop on its own line. Note: >1000 chars per line may cause problems.
dos.writeBytes(doc.getItemValueString("body") +" \n");
dos.writeBytes(".\n");
// We are done, quit
dos.writeBytes("QUIT\n");
br.readLine();
// Close the connection
dos.flush();
sock.close();